package com.yu.crm.service.impl;

import com.yu.crm.domain.pojo.CrmSearchPoint;
import com.yu.crm.mapper.CrmSearchPointMapper;
import com.yu.crm.service.ICrmSearchPointService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yxzz.common.helper.DataHelpers;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;

/**
 * <p>
 * 二维码巡更点 服务实现类
 * </p>
 *
 * @author neo
 * @since 2020-07-22
 */
@Service
public class CrmSearchPointService extends ServiceImpl<CrmSearchPointMapper, CrmSearchPoint> implements ICrmSearchPointService {

    @Override
    public void addOrUpdate(CrmSearchPoint crmSearchPoint){


        if(DataHelpers.isNotEmpty(crmSearchPoint.getId())){
            crmSearchPoint.setGmtModified(LocalDateTime.now());
            this.updateById(crmSearchPoint);
        }else{
            //TODO 生成二维码

            crmSearchPoint.setGmtCreate(LocalDateTime.now());
            crmSearchPoint.setGmtModified(LocalDateTime.now());
            this.save(crmSearchPoint);
        }



    }
}
